package com.teach;

import java.io.File;
import java.net.URI;

public class File01 {
	public static void main(String[] args) {
		File f1 = new File("a.txt");
		System.out.println(f1);
		
		//完整路径
		File  f2 = new File("E:\\PR//a.txt");
		System.out.println(f2);
		//Linux
		File f3 = new File("");
		System.out.println(f3);
		
		//目录
		File f4 = new File("E:\\PR");
		
		//获取文件的绝对路径
		System.out.println(f1.getAbsolutePath());
		System.out.println(f1.getAbsoluteFile()+"\n");
		
		//是否存在
		System.out.println("f1.exists():"+f1.exists());
		System.out.println("f2.exists():"+f2.exists());
		System.out.println("f3.exists():"+f3.exists());
		System.out.println("f4.exists():"+f4.exists()+"\n");
		
		//是否存在
		System.out.println("f1.isFile()"+f1.isFile());
		System.out.println("f2.isFile()"+f2.isFile());
		System.out.println("f3.isFile()"+f3.isFile());
		System.out.println("f4.isFile()"+"+"+(File.pathSeparatorChar)+"+"+f4.isFile()+"\n");
		
		System.out.println(File.pathSeparator);
		System.out.println(File.pathSeparatorChar);
		System.out.println(File.separator);
		System.out.println(File.separatorChar+"\n");
		
		URI uri = f2.toURI();
		System.out.println(uri+"\n");
		//System.out.println(FileUtil.get);
		
	}
}
